﻿#$language = "Python"
#$interface = "1.0"

import os
import sys

g_local_path = os.path.dirname(os.path.abspath(__file__))
g_common_path = g_local_path + "\\common"
if g_common_path not in sys.path:
    sys.path.insert(0, g_common_path)

import counter_main
import screen
import debug
from const import CONST_STYLE_CRNC
from counter_const import COUNTER_INDIVIDUAL as INDIVIDUAL

def main():
    crt.Screen.Synchronous = True
    debug.log_start(__file__)
    log = debug.Log('')

    session_name = (crt.Session.Path).split('\\').pop()
    log.w("trace counter in " + session_name)

    prompt = screen.Prompt()
    prompt.set_prompt(crt)
    
    if prompt.style == CONST_STYLE_CRNC:
        counters = {
            "CR1024":   ["M1002C679", "M1002C689", "M1002C690", "M1002C691", \
                         "M1006C209", "M1006C210", "M1006C245", "M1006C247", \
                         "M1006C302"],
            "RAN2963":  ["M1006C309"],
            INDIVIDUAL: ["M1000C999", "M1002C999", "M1006C999", "M1006C302"]
        }
        counter_main.trace_counters(crt, counters)
    else:
        log.w('This session {0} not support.'.format(prompt.style))

    del log
    crt.Screen.Synchronous = False

main()
